@extends('default.layouts.companyPublic')

@section('title', '企业基本资料')
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/company/basic_info.css')}}">
@endsection

@section('rightcon')

    <div class="right">
        <div class="basicInfoForm">
            <div class="regInfo">
                {{--内菜单--}}
                <div class="jobtitle">
                    <div class="tithead">
                        <ul>
                            <li class="active"><a href="{{url('company/basic_info')}}">基本资料</a></li>
                            <li><a href="{{url('company/license_sub')}}">企业认证</a></li>
                            <li><a href="{{url('company/department')}}">部门管理</a></li>
                            <li><a href="{{url('company/map')}}">地图坐标</a></li>
                            <li><a href="{{url('company/photo')}}">企业相册</a></li>
                        </ul>
                    </div>
                </div>
                {{--公司信息--}}
                <form action="{{url('company/basic_info')}}" method="post" onSubmit="return false" name="regBasicForm"
                      id="regBasicForm">
                    <input type="hidden" id="id" name="id" value="{{$CompanyBasic->id}}">
                    {{csrf_field()}}
                    <div class="regForm comInfo">
                        <div class="fTitle">
                            <span class="line"><span>基本信息</span></span>
                        </div>
                        {{--输出全部错误信息--}}
                        @if(count($errors)>0)
                            <div class="errors" style=" margin-top: 15px">
                                <ul>
                                    @if(is_object($errors))
                                        @foreach($errors->all() as $error)
                                            <li><span>{{$error}}</span></li>
                                        @endforeach
                                    @else
                                        <li><span>{{$errors}}</span></li>
                                    @endif
                                </ul>
                            </div>
                        @endif
                        <div class="formCon">
                            <dl>
                                <dt><span class="caption">公司名称</span><span class="asterisk">*</span></dt>
                                <dd><input type="text" name="company_name" id="company_name"
                                           value="{{$CompanyBasic->company_name}}" placeholder="请输入公司名称" tip="请输入公司名称">
                                </dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">品牌</span></dt>
                                <dd><input type="text" name="brands" id="brands" style="width: 222px;"
                                           value="{{$CompanyBasic->brands}}" placeholder="请输入公司品牌" tip="请输入公司品牌"></dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">公司性质</span><span class="asterisk">*</span></dt>
                                <dd>
                                    <input id="comkind" name="comkind" type="hidden">
                                    <div id="comkind_select" class="select"><span><a></a></span><i></i></div>
                                </dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">所属行业</span><span class="asterisk">*</span></dt>
                                <dd>
                                    <input id="industry" name="industry" type="hidden">
                                    <div id="industry_select" class="select" style="width: 240px;">
                                        <span><a></a></span><i></i></div>
                                </dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">成立年份</span><span class="asterisk">*</span></dt>
                                <dd>
                                    <div class="showTime" id="showTime">
                                        <input name="established" id="established" type="hidden"
                                               value="{{$CompanyBasic->established}}">
                                    </div>
                                </dd>
                                <dd class="errinfo"></dd>
                            </dl>

                            <dl>
                                <dt><span class="caption">员工数量</span><span class="asterisk">*</span></dt>
                                <dd>
                                    <input id="employee_num" name="employee_num" type="hidden">
                                    <div id="employee_num_select" class="select"><span><a></a></span><i></i></div>
                                </dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">公司诱惑</span><span class="asterisk">*</span></dt>
                                <dd style="width: 570px;">
                                    <span class="selTemptation" id="selTemptation">
                                        <input name="temptation" value="{{$CompanyBasic->temptation}}" id="temptation"
                                               type="hidden">
                                        <input type="text" name="showTemptation" id="showTemptation"
                                               value="{{$CompanyBasic->temptation}}" readonly style="cursor: text"
                                               placeholder="例如：包吃，包住，五险一金，老板人好">
                                        <i class="yicon"></i>
                                    </span>
                                </dd>
                                <dd class="errinfo" style="width: 140px;"></dd>
                            </dl>
                            <dl style=" height: 112px;">
                                <dt style=" height: 112px;"><span class="caption">公司简介</span><span
                                            class="asterisk">*</span></dt>
                                <dd style=" height: 112px;"><textarea name="profile" id="profile" placeholder="请输入公司简介"
                                                                      tip="请输入公司简介">{{$CompanyBasic->profile}}</textarea>
                                </dd>
                                <dd class="errinfo" style="width: 140px;"></dd>
                            </dl>
                        </div>
                    </div>

                    {{--联系方式--}}
                    <div class="regForm comInfo">
                        <div class="fTitle">
                            <span class="line"><span>联系方式</span></span>
                        </div>
                        <div class="formCon">
                            <dl>
                                <dt><span class="caption">联系人</span><span class="asterisk">*</span></dt>
                                <dd><input type="text" name="contacts" id="contacts" style=" width: 180px;"
                                           value="{{$CompanyBasic->contacts}}" placeholder="请输入联系人" tip="请输入联系人"></dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">手机号码</span></dt>
                                <dd><input type="text" name="mobile" id="mobile" value="{{$CompanyBasic->mobile}}"
                                           placeholder="请输入手机号码" tip="请输入手机号码"></dd>
                                <dd class="errinfo"></dd>
                            </dl>

                            <dl>
                                <dt><span class="caption">联系电话</span></dt>
                                <dd>
                                    <input type="text" name="area_code" id="area_code" style="width:50px;"
                                           value="{{$CompanyBasic->area_code}}" placeholder="区号">
                                    <input type="text" name="phone" id="phone" style="width:140px; margin-left: 10px;"
                                           value="{{$CompanyBasic->phone}}" placeholder="固定电话" tip="请输入电话">
                                    <input type="text" name="ext" id="ext" style="width:50px;margin-left: 10px;"
                                           value="{{$CompanyBasic->ext}}" placeholder="分机号">
                                </dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl style=" margin: 0">
                                <dt></dt>
                                <dd class="tips"><span class="asterisk">*</span>固定电话与手机号码必须填写一项</dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">传真</span></dt>
                                <dd><input type="text" name="fax" id="fax" value="{{$CompanyBasic->fax}}"
                                           style=" width: 160px;" placeholder="请输入传真号码" tip="请输入传真号码"></dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">电子邮件</span></dt>
                                <dd><input type="text" name="email" id="email" value="{{$CompanyBasic->email}}"
                                           style=" width:240px;" placeholder="请输入电子邮件" tip="请输入电子邮件"></dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">QQ号码</span></dt>
                                <dd><input type="text" name="qq" id="qq" value="{{$CompanyBasic->qq}}"
                                           style=" width: 160px;" placeholder="请输入QQ号码" tip="请输入QQ号码"></dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">所在地区</span><span class="asterisk">*</span></dt>
                                <dd>
                                    <input id="region" name="region" type="hidden" value="{{$CompanyBasic->region}}">
                                    <input id="province" name="province" type="hidden">
                                    <div id="province_select" class="select"><span><a></a></span><i></i></div>
                                    <input id="area" name="area" type="hidden">
                                    <div id="area_select" class="select" style="margin-left: 5px;">
                                        <span><a></a></span><i></i></div>
                                    <input id="city" name="city" type="hidden" value="{{$CompanyBasic->region}}">
                                    <div id="city_select" class="select" style="margin-left: 5px;">
                                        <span><a></a></span><i></i></div>
                                </dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">详细地址</span><span class="asterisk">*</span></dt>
                                <dd>
                                    <input type="text" name="address" id="address" style="width:400px;"
                                           value="{{$CompanyBasic->address}}" placeholder="请输入详细地址" tip="请输入详细地址">
                                </dd>
                                <dd class="errinfo" style="width: 140px;"></dd>
                            </dl>

                            <dl class="setMapCss">
                                <dt></dt>
                                <dd>
                                    <input name="position" type="hidden" id="position"
                                           value="@if($CompanyBasic->longitude){{$CompanyBasic->longitude}},{{$CompanyBasic->latitude}},{{$CompanyBasic->coordinate_address}}@endif"/>
                                    <input name="coordinate_address" type="hidden" id="coordinate_address"
                                           value="{{$CompanyBasic->coordinate_address}}"/>
                                    <input name="longitude" type="hidden" id="longitude"
                                           value="{{$CompanyBasic->longitude}}"/>
                                    <input name="latitude" type="hidden" id="latitude"
                                           value="{{$CompanyBasic->latitude}}"/>
                                    <span class="setmap"><a id="setMap">设置坐标</a></span>
                                    @if($CompanyBasic->longitude)
                                        <span class="noset" id="noset"
                                              style="color: #999">已设置地图位置：{{$CompanyBasic->coordinate_address}}</span>
                                    @else
                                        <span class="noset" id="noset">未设置</span>
                                    @endif
                                </dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">公司网站</span></dt>
                                <dd><input type="text" name="website" id="website" style="width:240px;"
                                           value="{{$CompanyBasic->website}}" placeholder="请输入公司网站" tip="请输入公司网站"></dd>
                                <dd class="errinfo"></dd>
                            </dl>
                            <dl>
                                <dt><span class="caption">乘车路线</span></dt>
                                <dd><input type="text" name="lines" id="lines" value="{{$CompanyBasic->lines}}"
                                           style="width:400px;" placeholder="请输入乘车路线" tip="请输入乘车路线"></dd>
                                <dd class="errinfo"></dd>
                            </dl>

                            <dl style="margin-top: 30px;">
                                <dt></dt>
                                <dd><input type="submit" name="sub" id="sub" class="sub" value="保 存"></dd>
                            </dl>
                        </div>
                    </div>
                </form>
                {{--//注册表单--}}
            </div>
        </div>
    </div>
@endsection
@section('footerjs')
    @parent
    <script type="text/javascript">
        $("#leftnav_data").addClass("active");
    </script>
    <!--弹出层显示职位诱惑posTemptation插件-->
    <div class="showPosTemptation" id="showPosTemptation"></div>
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.posTemptation.js')}}"></script>

    <!--选择地图定位map-->
    <div id="twobox_sceen" class="twobox_sceen"></div>
    <script type="text/javascript" src="{{asset('/default/js/company/setmap.js')}}"></script>

    <!--弹出层显示时间加载插件-->
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.autoTime.js')}}"></script>

    <script type="text/javascript" src="{{Resources::jsOption('company')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.validate.extend.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.placeholder.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/company/registerBasic.js')}}"></script>

    <!--地区三级联动-->
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.select.area.js')}}"></script>

    {{--JS信息--}}
    <script type="text/javascript">
        //分帧显示地址
        var iframeMapUrl = "{{ url('company/iframe_map') }}";
        $(function(){
            var selectComkind = $("#comkind").select({optionData: option_comkind, selected:{{$CompanyBasic->comkind}}});
            //为这个对象添加一个新元素
            option_industry.unshift({"text": "请选择", "value": ''});
            var selectIndustry = $("#industry").select({
                optionData: option_industry,
                selected: '{{$CompanyBasic->industry}}'
            });
            var selectEmployee_num = $("#employee_num").select({
                optionData: option_employee_num,
                selected: '{{$CompanyBasic->employee_num}}'
            });
            //公司诱惑
            var comTemp = ["双休", "包吃", "包住", "五险", "公积金", "年终奖", "旅游", "培训", "带薪年假", "节日礼物", "定期体检", "免费班车", "加班补贴", "交通补贴",
                "话费补贴", "员工持股", "岗位晋升", "8小时工作制", "项目提成", "美女多", "办公高大上", "员工餐厅", "健身房", "活动室", "配车"];
            $("#selTemptation").posTemptation({
                posArr: comTemp,                               //传入职位诱惑数组
                showPosTemptation: '#showPosTemptation',       //追加到什么位置
                posTemptation: "#temptation",                  //赋值到某个表单的值
                showTemptation: "#showTemptation",              //显示到某个表单的值
                ismod: '1'
            });

            //基于包装集autoTime函数插件
            $("#showTime").autoTime({
                year: "year",                               //弹出层年份
                month: "month",                             //弹出层月份
                established: '#established'                 //成立年份id
            });

            //地区联动
            $("#region").selectArea({
                'province': $('#province'),
                'area': $('#area'),
                'city': $('#city'),
                'selected': "{{$CompanyBasic->region}}"
                //'provinceNull':true,
                //'areaNull':true,
                //'cityNull':true
            });

            @if(session('ok'))
            layer.ready(function(){
                layer.msg("{{session('ok')}}");
            });
            @endif
        });
    </script>
@endsection
